﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iLangl.LanguageWire.Managers
{
	public class MappingManager
	{
		#region Singelton Pattern
		private MappingManager()
		{
		}

		private static MappingManager instance;
		private static object mutex = new object();
		/// <summary>
		/// The instance of the MappingManager.
		/// </summary>
		public static MappingManager Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							instance = new MappingManager();
						}
					}
				}
				return instance;
			}
		}
		#endregion

		public TranslationStatuses.eTranslationStatus GetTranslationStatus(int lwStatus)
		{
			switch (lwStatus)
			{
				
				case 1:
				case 2:
					return TranslationStatuses.eTranslationStatus.Configuration;
				case 3:
					return TranslationStatuses.eTranslationStatus.InProgress;
				case 4:
					return TranslationStatuses.eTranslationStatus.Finished;
				case 0:
				case 10:
				case 11:
				default:
					return TranslationStatuses.eTranslationStatus.Unknown;
			}
		}

		public int GetTranslationStatus(string status)
		{
			switch (status)
			{
				case TranslationStatuses.Configuration:
					return 1;
				case TranslationStatuses.InProgress:
					return 3;
				case TranslationStatuses.Finished:
					return 4 ;
				default:
					return 0;
			}
		}
	}
}
